package com.hqd.ch03.v46.core.annotation;


import java.lang.annotation.Annotation;

/**
 * 处理注解回调
 *
 * @param <C>
 * @param <R>
 */
@FunctionalInterface
interface AnnotationsProcessor<C, R> {

    /**
     * 注解处理回调
     *
     * @param context
     * @param aggregateIndex
     * @return
     */
    default R doWithAggregate(C context, int aggregateIndex) {
        return null;
    }

    R doWithAnnotations(C context, int aggregateIndex, Object source, Annotation[] annotations);

    default R finish(R result) {
        return result;
    }
}
